---
title: Menus
description: Learn about how to interact with Pages using WPGraphQL
---

import GraphiQL from "../../src/components/GraphiQL"

There are various points of entry for menus and their items.

## Queries

The `menus` query is the only query that will return all of the menus on your site. If you would like to query a specific menu or that menu's data, you will need the menu or menuItem's ID.

### Menus

<GraphiQL
	query="
    {
      menus {
        nodes {
          id
          menuId
          menuItems {
            edges {
              node {
                id
                menuItemId
                title
                url
                connectedObject {
                  __typename
                }
                cssClasses
                description
                label
                linkRelationship
                target
              }
            }
            nodes {
              id
              menuItemId
              title
              url
              connectedObject {
                __typename
              }
              cssClasses
              description
              label
              linkRelationship
              target
            }
          }
        }
      }
    }"
/>

After running the `menus` query grab one of the IDs in the response and use it in the other queries below.

### Menu

<GraphiQL
	withDocs={true}
	query="
  query GET_MENU( $id: ID! ){
      menu(id: $id) {
        count
        id
        menuId
        name
        slug
        menuItems {
          nodes {
            id
            menuItemId
            title
            url
            cssClasses
            description
            label
            linkRelationship
            target
          }
        }
      }
  }"
	variables={{
		id: "TWVudTo5",
	}}
/>

### Menu Item

<GraphiQL
	withDocs={true}
	query="
     query GET_MENU_ITEM( $id: ID! ){
       menuItem( id: $id ) {
         id
         menuItemId
         title
         url
         connectedObject {
            __typename
         }
         cssClasses
         description
         label
         linkRelationship
         target
       }}"
	variables={{
		id: "bmF2X21lbnVfaXRlbToxMDQ2",
	}}
/>

### Menu Items

<GraphiQL
	withDocs={true}
	query="{
  menuItems(where: {location: PRIMARY}){
    edges {
      node {
        id
        menuItemId
        title
        url
        connectedObject {
          __typename
        }
        cssClasses
        description
        label
        linkRelationship
        target
      }
    }
    nodes {
      id
      menuItemId
      title
      url
      connectedObject {
        __typename
      }
      cssClasses
      description
      label
      linkRelationship
      target
    }
  }}"
/>
